package ran.friend.domain.exam.dto;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import ran.entity.PageQueryDTO;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ran
 * Date: 2025-11-06
 * Time: 15:04
 */
@Data
public class ExamQueryDTO extends PageQueryDTO {
    private String title;
    private String startTime;
    private String endTime;
    private Integer type; // 0: 未完赛,  1: 历史竞赛
    // 获取转换后的LocalDateTime
    public LocalDateTime getStartTime() {
        return StrUtil.isEmpty(startTime) ? null : LocalDateTime.parse(startTime, DateTimeFormatter.ISO_DATE_TIME);
    }
    public LocalDateTime getEndTime() {
        return StrUtil.isEmpty(endTime) ? null : LocalDateTime.parse(endTime, DateTimeFormatter.ISO_DATE_TIME);
    }
}
